package com.hmkj.core.api.juhe.bean;

import java.util.Objects;

/**
 * 描述: 聚合数据错误参照码
 * 作者: syx
 * 时间: 2016/11/29 17:31
 */
public class JuHeErrorCode {

    /**
     * 开启 通用状态枚举
     *
     * @author zheng hualiang
     *
     */
    public enum ErrCode {
        SUCCESS(0,"调用成功"),
        NO_RECORD(210301, "库中无此身份证记录"),
        SERVER_EXCE(210302, "第三方服务器异常"),
        SERVER_FIXING(210303, " 服务器维护"),
        PARAMS_EXCE(210304, "参数异常"),
        NETWORK_ERR(210305, "网络错误，请重试"),
        WRONG_CARDNO_ERR(888802, "不是正确的卡号"),
        NO_EXIST(888803, "暂无此银行卡记录"),
        NOT_ENOUGH(10012, "当前可请求的次数不足"),
        PARAMS_ERR(210306, "参数错误，具体参照reason");

        private Integer value;
        private String name;

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public Integer getValue() {
            return value;
        }

        public void setValue(Integer value) {
            this.value = value;
        }

        ErrCode(Integer Value, String name) {
            this.value = Value;
            this.name = name;
        }

        public static String getNameByValue(Integer value) {
            if (value != null) {
                for (ErrCode a : ErrCode.values()) {
                    if (Objects.equals(a.getValue(), value)) {
                        return a.getName();
                    }
                }
            }
            return null;
        }
    }
}
